package cn.clwxy.gdz.service;

import java.util.List;

import org.apache.commons.dbutils.handlers.BeanListHandler;

import cn.clwxy.gdz.bo.IndexTeacherListBean;
import cn.clwxy.gdz.entity.Teacher;
import cn.clwxy.gdz.util.BaseDao;

public class IndexTeacherBeanServiceImpl extends BaseDao implements IndexTeacherBeanService {

	@Override
	public List<IndexTeacherListBean> getHighTeachers() {
		String sql="SELECT t.teacherId,i.src ,t.teacherRealName,t.teacherEducation,t.teacherSex,t.selfmark "+
				"from teacher t "+
				"INNER JOIN imgid i "+
				"on t.teacherImgId=i.id "+
				"WHERE t.teacherId IN (SELECT teacherId as id from teachergraderelative  WHERE gradeId IN( SELECT id from grade WHERE pid=4 ))"+
				"ORDER BY t.teacherLevel,t.teacherUpdateDate "+
				"LIMIT 0,10";
		return super.queryList(sql, new BeanListHandler<IndexTeacherListBean>(IndexTeacherListBean.class));
	}
	public List<IndexTeacherListBean> getMiddleTeachers() {
		String sql="SELECT t.teacherId,i.src ,t.teacherRealName,t.teacherEducation,t.teacherSex,t.selfmark "+
				"from teacher t "+
				"INNER JOIN imgid i "+
				"on t.teacherImgId=i.id "+
				"WHERE t.teacherId IN (SELECT teacherId as id from teachergraderelative  WHERE gradeId IN( SELECT id from grade WHERE pid=3 ))"+
				"ORDER BY t.teacherLevel,t.teacherUpdateDate "+
				"LIMIT 0,10";
		return super.queryList(sql, new BeanListHandler<IndexTeacherListBean>(IndexTeacherListBean.class));
	}
	public List<IndexTeacherListBean> getPrimaryTeachers() {
		String sql="SELECT t.teacherId,i.src ,t.teacherRealName,t.teacherEducation,t.teacherSex,t.selfmark "+
				"from teacher t "+
				"INNER JOIN imgid i "+
				"on t.teacherImgId=i.id "+
				"WHERE t.teacherId IN (SELECT teacherId as id from teachergraderelative  WHERE gradeId IN( SELECT id from grade WHERE pid=2 ))"+
				"ORDER BY t.teacherLevel,t.teacherUpdateDate "+
				"LIMIT 0,10";
		return super.queryList(sql, new BeanListHandler<IndexTeacherListBean>(IndexTeacherListBean.class));
	}
}
